Skip to content

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Jun 11, 2025

These are the final piece missing for

We cannot use the previous scheme of using an integer range for raw pointers, as we're not just changing the layout of raw pointers anymore, but also the type representation. And we can't represent "any provenance or NonZero" natively as patterns. So I created a new !null pattern. Since this is all unstable representation stuff for replacing rustc_layout_scalar_range_start with pattern types, the divergence from normal patterns is fine, especially since T-lang seems interested in exploring general negation patterns

r? @BoxyUwU

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 11, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jun 11, 2025

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

changes to the core type system

cc @compiler-errors, @lcnr

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

HIR ty lowering was modified

cc @fmease

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

The Miri subtree was changed

cc @rust-lang/miri

Some changes occurred in src/tools/rustfmt

cc @rust-lang/rustfmt

changes to the core type system

cc @compiler-errors, @lcnr

Some changes occurred in compiler/rustc_codegen_ssa

cc @WaffleLapkin

@rust-log-analyzer

This comment has been minimized.

@oli-obk oli-obk force-pushed the not-null-pattern-types branch from 02f19f4 to 57dc73a Compare June 11, 2025 08:29
@rust-log-analyzer

This comment has been minimized.

@oli-obk oli-obk force-pushed the not-null-pattern-types branch from 57dc73a to 0adc902 Compare June 11, 2025 11:25
@rust-log-analyzer

This comment has been minimized.

@oli-obk oli-obk force-pushed the not-null-pattern-types branch from 0adc902 to 9944787 Compare June 11, 2025 14:51
@rust-log-analyzer

This comment has been minimized.

@oli-obk oli-obk force-pushed the not-null-pattern-types branch from 9944787 to 8c271d9 Compare June 12, 2025 08:00
@oli-obk oli-obk force-pushed the not-null-pattern-types branch from 8c271d9 to 50cab82 Compare June 17, 2025 15:08
@rustbot
Copy link
Collaborator

rustbot commented Jun 17, 2025

These commits modify the library/Cargo.lock file. Unintentional changes to library/Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

@bors
Copy link
Collaborator

bors commented Jul 4, 2025

☔ The latest upstream changes (presumably #143434) made this pull request unmergeable. Please resolve the merge conflicts.

@oli-obk oli-obk force-pushed the not-null-pattern-types branch 2 times, most recently from 1c997f2 to 47869c2 Compare July 7, 2025 09:46
@rust-log-analyzer

This comment has been minimized.

@oli-obk oli-obk force-pushed the not-null-pattern-types branch from 47869c2 to b20dd1d Compare July 7, 2025 11:31
@rust-log-analyzer

This comment has been minimized.

@oli-obk oli-obk force-pushed the not-null-pattern-types branch from b20dd1d to 96205ed Compare July 7, 2025 12:37
@bors
Copy link
Collaborator

bors commented Jul 7, 2025

☔ The latest upstream changes (presumably #143582) made this pull request unmergeable. Please resolve the merge conflicts.

@oli-obk oli-obk force-pushed the not-null-pattern-types branch from 96205ed to 66255f9 Compare July 8, 2025 07:15
@rustbot
Copy link
Collaborator

rustbot commented Jul 8, 2025

This PR changes Stable MIR

cc @oli-obk, @celinval, @ouz-a

@bors
Copy link
Collaborator

bors commented Jul 14, 2025

☔ The latest upstream changes (presumably #143934) made this pull request unmergeable. Please resolve the merge conflicts.

@oli-obk oli-obk force-pushed the not-null-pattern-types branch from 66255f9 to 962d6ac Compare July 15, 2025 08:32
@rustbot rustbot added the T-clippy Relevant to the Clippy team. label Jul 15, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jul 15, 2025

This PR changes rustc_public

cc @oli-obk, @celinval, @ouz-a

@oli-obk oli-obk force-pushed the not-null-pattern-types branch from 962d6ac to 8f23c36 Compare July 23, 2025 06:56
@rustbot rustbot added the T-rust-analyzer Relevant to the rust-analyzer team, which will review and decide on the PR/issue. label Sep 23, 2025
@Dylan-DPC Dylan-DPC added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 24, 2025
Comment on lines 277 to 285
// Make wide pointer pattern types contain only a single field
// of the wide pointer type itself.
layout.fields = FieldsShape::Arbitrary {
offsets: [Size::ZERO].into_iter().collect(),
memory_index: [0].into_iter().collect(),
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't understand what this is doing/why we're inventing a field. also this applies to thin pointers too :3

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was encountering annoying to handle situations in various places (like const validation) where I had to duplicate the logic for pointers (wide or thin) on pattern types, because the pattern types directly contained all the information. Now that the pattern types "wrap" the pointer type, all the normal pointer logic simply runs after recursively walking the pattern type's layout. So this makes everything else more robutst, even if technically not necessary

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I edited the comment to clarify this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

talked about this sync. we think layout of all pattern types should do this "has a field" thing rather than it being !null pattern types of pointers specifically

@BoxyUwU BoxyUwU added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 24, 2025
@oli-obk oli-obk force-pushed the not-null-pattern-types branch from 7522c0d to 15800b9 Compare October 14, 2025 10:48
@rustbot

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@oli-obk oli-obk force-pushed the not-null-pattern-types branch from 15800b9 to d3e56c9 Compare October 14, 2025 14:59
@bors
Copy link
Collaborator

bors commented Oct 16, 2025

☔ The latest upstream changes (presumably #146221) made this pull request unmergeable. Please resolve the merge conflicts.

@oli-obk oli-obk force-pushed the not-null-pattern-types branch from d3e56c9 to 713d711 Compare October 21, 2025 09:52
@rustbot
Copy link
Collaborator

rustbot commented Oct 21, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@rust-log-analyzer

This comment has been minimized.

@oli-obk oli-obk force-pushed the not-null-pattern-types branch from 713d711 to 2a3c83b Compare October 21, 2025 10:13
@oli-obk oli-obk force-pushed the not-null-pattern-types branch from 2a3c83b to 9a953cf Compare October 21, 2025 10:46
@rust-log-analyzer

This comment has been minimized.

@oli-obk oli-obk force-pushed the not-null-pattern-types branch from 9a953cf to 375899c Compare October 21, 2025 11:23
@oli-obk
Copy link
Contributor Author

oli-obk commented Oct 21, 2025

@bors r=BoxyUwU

@bors
Copy link
Collaborator

bors commented Oct 21, 2025

📌 Commit 375899c has been approved by BoxyUwU

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 21, 2025
bors added a commit that referenced this pull request Oct 22, 2025
Rollup of 7 pull requests

Successful merges:

 - #141445 (Add `FromIterator` impls for `ascii::Char`s to `String`s)
 - #142339 (Add NonNull pattern types)
 - #147768 (Code refactoring on hir report_no_match_method_error)
 - #147788 (const Cell methods)
 - #147932 (Create UTF-8 version of `OsStr`/`OsString`)
 - #147933 (os_str: Make platform docs more consistent)
 - #147948 (PassWrapper: Access GlobalValueSummaryInfo::SummaryList via getter for LLVM 22+)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit f6d324f into rust-lang:master Oct 22, 2025
11 checks passed
@rustbot rustbot added this to the 1.92.0 milestone Oct 22, 2025
@oli-obk oli-obk deleted the not-null-pattern-types branch October 22, 2025 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rust-analyzer Relevant to the rust-analyzer team, which will review and decide on the PR/issue. T-rustfmt Relevant to the rustfmt team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants